<?php
class Bootstrap extends Zend_Application_Bootstrap_Bootstrap {
	protected function _initDatabase(){
		$db = $this->getPluginResource('db')->getDbAdapter();
		
		$dbOption = $this->getOption('resources');
		$dbOption = $dbOption['db'];
		
		$db = Zend_Db::factory($dbOption['adapter'], $dbOption['params']);
	
	    $db->setFetchMode(Zend_Db::FETCH_ASSOC);
	    //$db->query("SET NAMES 'utf8'");
	    //$db->query("SET CHARACTER SET 'utf8'");
		    Zend_Registry::set('db', $db);
		    
	    Zend_Db_Table::setDefaultAdapter($db);
	    return $db;
	}
	
 protected function _initCachemanager(){
        $cacheManager=new Zend_Cache_Manager;
        $dbcache=array(
            'frontend'=>array(
                'name'=>'Core',
                'options'=>array(
                    'lifetime'=>null,
                    'automatic_serialization'=>'true',
                ),
            ),
            'backend'=>array(
                'name'=>'File',
                'options'=>array(
                    'cache_dir'=>CACHE_DIR,
                ),
            ),
        );
        $cacheManager->setCacheTemplate('dbcache',$dbcache);
        return $cacheManager;
    }
}

